package com.qf.test.dao;

import com.qf.test.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface UserDao {
    /**
     *查询所有的用户
     */
    @Select("SELECT * FROM t_users")
    public List<User>  findAll();

    /**
     * 根据id进行查询
     * @return
     */
    @Select("SELECT * FROM t_users WHERE id=#{id}")
    public User findId(Integer id);

    //删除用户
    @Delete("DELETE FROM t_users WHERE id=#{id}")
    public int deleted(@Param("id")Integer id);

    //添加用户
    @Insert("INSERT INTO t_users (id,name,password,sex,birthday,registTime) VALUE (#{user.id},#{user.name}" +
            ",#{user.password},#{user.sex},#{user.birthday},#{user.registTime})")
    public int insretinone(@Param("user")User user);
    //修改用户
   // @Update("UPDATE t_users SET `name`=#{user.name},`password`=#{user.password},sex=#{user.sex},birthday=#{user.birthday},registTime=#{user.registTime} WHERE id=#{user.id}")
    public int updateUser(@Param("user")User user);


}
